import {parse} from 'qs';

export default {
    namespace: 'drawerApproval',
    state: {
        list: [{
            key: '1',
            drawerName: '广州市盈基服装有限公司',
            taxpayerId: '440100596157462',
            applicant: 'Ron',
            applyTime: '2017-10-10 10:32',
            status: 'NEW'
        }],
        editModel: { // 编辑视图
            showStatus: false, // 默认不显示
            confirmLoading: false, // 确认按钮loading状态
            title: '创建客户' // 标题
        }
    },
    reducers: {
        /**
         * 是否显示
         *
         * @param state
         * @param action
         * @returns {{showStatus: (boolean|*)}}
         */
        setEditModel(state, action) {
            let payload = action.payload;

            let newState = {...state.editModel};
            if(payload.showStatus != undefined) {
                newState.showStatus = payload.showStatus;
            }
            if(payload.title != undefined) {
                newState.title = payload.title;
            }
            if(payload.confirmLoading != undefined) {
                newState.confirmLoading = payload.confirmLoading;
            }

            return {...state, editModel: {...newState}};
        }
    },
    effects: {
    },
    subscriptions: {
    }
};
